<?php namespace Home\Controller;

// use Framework\Model\Db;
use Framework\Kernel\Controller;
use Home\Model\User;

class LoginController extends Controller{

	protected $db;

	public function __init()
	{
		$this->db = new User;
	}

	//注册
	public function reg()
	{	
		if(!$this->db->reg())
		{
			echo $this->db->error();
		}else{
			$this->success('注册成功');
		}
	}

	//登录
	public function login()
	{
		if(!$this->db->login())
		{
			echo $this->db->error();
		}else{
			$this->success('登录成功');
		}		
	}


	//退出登录
	public function quit()
	{
		session_unset();
		session_destroy();
		header('location:?');
	}



















}